/*
 * Josh Lindoo
 * Login ID : lind6441
 * CS-102, Winter 2013
 * Programming Assignment 2
 * ShowingNode class: Used to generate nodes for a showing linked list
 */

public class ShowingNode {
	private Showing data; //data
	private ShowingNode next; //link to next node
	
	/**
	 * Default constructor
	 */
	public ShowingNode() {
		data = null;
		next = null;
	}
	
	/**
	 * Constructor
	 * @param item	data item
	 */
	public ShowingNode(Showing item) {
		setData(item);
		next = null;
	}
	
	public int checkOrder(ShowingNode currShow) {
		
		if(currShow == null) return 1;
		
		long newShowTime = data.getFullTime();
		long currShowTime = currShow.getData().getFullTime();
		
		if(newShowTime < currShowTime) {
			return 1; //newShow comes before currShow
		}
		else {
			return 2; //newShow comes after currShow
		}
	}
	
	/**
	 * Accessor for data
	 * @return data
	 */
	public Showing getData() {
		return data;
	}
	
	/**
	 * Accessor for next
	 * @return next
	 */
	public ShowingNode getNext() {
		return next;
	}
	
	/**
	 * Mutator for data
	 * @param item	Item to be stored in data
	 */
	public void setData(Showing item) {
		this.data = item;
	}
	
	/**
	 * Mutator for next
	 * @param next	Reference to next node
	 */
	public void setNext(ShowingNode next) {
		this.next = next;
	}
	
}
